# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=py3-rpds-py
pkgver=0.20.1
pkgrel=0
pkgdesc="Python bindings to the Rust Persistent Data Structures (rpds) crate"
url="https://github.com/crate-py/rpds"
arch="all"
license="MIT"
makedepends="
	cargo
	py3-gpep517
	py3-maturin
	"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://github.com/crate-py/rpds/releases/download/v$pkgver/rpds_py-$pkgver.tar.gz"
builddir="$srcdir/rpds_py-$pkgver"
options="net" # Required to download Rust crates

prepare() {
	default_prepare

	cargo fetch --locked
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--config-json '{"build-args": "--frozen"}' \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
326062aa5cffae52b65d697a101d72dff15fd7d684541936a89e4c69c2c5b6b6bb6c4ba7a0a62639a65b36e7d8c7615b515b6965ca42f699c4dfe036a2786c7c  rpds_py-0.20.1.tar.gz
"
